<html>

<head>
<title>gameEngine :: Tutorial 01</title>
<link rel="stylesheet" type="text/css" href="..\style.css" />
</head>

<body>
<h1>Tutorial 01: initial setup</h1>
First, let's create a new project<br>
<img class="normal" src="img/new_prj_1.png"><br>
You can replace the <i>d:\projects</i> with whatever you want. From now on, I'll refer only to the gameEngine folder, not the full path.<br>
Don't forget to check "empty project"<br>
<img class="normal" src="img/new_prj_2.png"><br>
Now delete the <b>Header files</b> and close the solution<br>
<img class="normal" src="img/del_headers.png"><br>
Go to <i>gameEngine\prj\win32</i> and rename <i>gameEngine</i> to <i>vc_2005</i>. Then create the folder structure you can see in this picture:<br>
<img class="normal" src="img/initial_structure.png"><br>
Now create a new file caled <i>resource.rc</i> in <i>gameEngine\src\win32</i>. In vc2005, right-click on the "resource files" folder, choose "add->existing item" and choose the "resource.rc". Then, in the resource view, right click on "resource.rc" and choose "add resource", then "icon". Create a new icon, then "save all". You'll get a warning that the file wasn't created by visual studio, but ignore it. Now you're ok.<br>
The created icon will be 32x32 with 16 colors. Go to Image->New Image Type and create the following types: 32x32 with 256 colors, 16x16 with 16 colors, 16x16 with 256 colors and 48x48 with 256 colors. The icons 32x32 are for icon view, 16x16 for detail view and 48x48 for thumbnail view. Now paint whatever you want there. You can switch between the various icon types with "Image->Current Icon Image Type". In the end you should have a nice icon that can be displayed successfully on any windows version.<br><br>
Now right-click on "source files" in the solution view and choose "add->new item...".<br>
<img class="normal" src="img/add_winmain.png"><br>
Now insert this code in the newly created file:

<pre class="cpp_code">
#include &lt;windows.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
	MessageBox(NULL, "Hello world!", "Test", MB_OK | MB_ICONINFORMATION);

	return 0;
}
</pre>

When compiling (F7) you'll get this error: <i> error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [13]' to 'LPCWSTR'</i>. That's because it's using unicode. We should disable this: Alt+F7 to see the project settings, then <b>Configuration properties -> General -> Character set</b> and change it to "Not Set".<br>
<img class="normal" src="img/char_set.png"><br>
Ok, now hit "build->clean solution" to delete most generated files, because we'll be relocating stuff. We want the exe to be generated in the game folder. Therefore, go to Settings (Alt+F7) "Configuration properties -> Linker -> General" and change Output file to <i>..\..\..\..\game\$(ProjectName).exe</i>.<br>
<img class="normal" src="img/output_dir.png"><br>
 This way the generated exe will end up where we want it. Now we just have to make it work there: Settings (Alt+F7) "Configuration Properties -> Debugging" and set Working Directory to <i>..\..\..\..\game</i><br>
<img class="normal" src="img/working_dir.png"><br>
Ooook, we're almost there! The next step is optional<br>
Let's commit it to svn. First of all, checkout the repository where you'll store the files. Then add the folders one by one, making sure not to add the debug folders. It's a good idea to clean the solution, so that you won't add the generated files.<br>
<img class="normal" src="img/svn_add.png"><br>
The next step is to do a fresh build and add to the ignore list all the other files. Then commit again the changes and you're done :)
<br><br>
<a href="..\tut02\tut02.html">Tutorial 02</a>
</body>
</html>